home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1657 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  831 b 

  1. Path: oxy.rust.net!usenet
  2. From: ebennett@rust.net
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Q: realloc->free?
  5. Date: Tue, 16 Jan 1996 05:36:47 GMT
  6. Organization: Rust Net - High Speed Internet in Detroit  810-642-2276
  7. Message-ID: <4df2ud$706@oxy.rust.net>
  8. References: <4daa2e$oh5@axe.netdoor.com>
  9. NNTP-Posting-Host: liv-25.rust.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. esargent@netdoor.com (Eric Sargent) wrote:
  13.  
  14.  
  15.  
  16. >    Now let's say realloc had to move the data so a != b.  Does realloc
  17. >free the memory previously pointed to by a or should it be explicitly
  18. >freed if realloc returns a new location?  I checked the FAQ, but there
  19. >was nothing specific about realloc.  Thanks for any information.
  20.  
  21. realloc() will free the old block.  It is perfectly legal to say
  22.  
  23.   a = realloc(a, newsize);
  24.  
  25. No memory loss should occur from this.
  26.  
  27. Earl
  28.  
  29.  
  30.